package day04;
//猜数字小游戏

import java.util.Scanner;

public class WhileGuessing {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = (int) (Math.random() * 100);
        System.out.println(num);
        System.out.println("请输入你想猜的数字");
        int guess = scan.nextInt();
        while (num != guess) {
            if (guess > num) {
                System.out.println("你猜的数字太大了，请重新猜");
            } else {
                System.out.println("你猜的数字太小了，请重新猜");
            }
            guess = scan.nextInt();
        }
        System.out.println("恭喜你猜对了！");
    }
}
